<template>
  <div class="dashboard-editor-container">
    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <div style="margin:0;font-size:24px;"><div id="icon_info" /><div style="height:46px;display:inline-block;color:#304156;font-weight:bolder">常用功能</div></div>
      <div style="background:#fff;height:90px;margin:0 0 20px;padding:20px;">
        <el-button v-if="usertype===1||usertype===2" type="text" class="indexBtn" @click="$router.push('/info/addinfo')">
          <svg-icon icon-class="form" class="indexBtnIcon" style="color:#69B942;" />
          <div class="indexBtnDiv">信息刊登</div>
        </el-button>
        <el-button v-if="usertype===1||usertype===2" type="text" class="indexBtn" @click="$router.push('/info/search')">
          <svg-icon icon-class="search" class="indexBtnIcon" style="color:#B94245;" />
          <div class="indexBtnDiv">信息查询</div>
        </el-button>
        <el-button v-if="usertype===1||usertype===2" type="text" class="indexBtn" @click="$router.push('/info/list')">
          <svg-icon icon-class="eye-open" class="indexBtnIcon" style="color:#42B9B7;" />
          <div class="indexBtnDiv">信息校对</div>
        </el-button>
        <el-button v-if="usertype===2" type="text" class="indexBtn" @click="$router.push('/info/collect')">
          <svg-icon icon-class="documentation" class="indexBtnIcon" style="color:#4282B9;" />
          <div class="indexBtnDiv">信息生成</div>
        </el-button>
        <el-button v-if="usertype===1||usertype===2" type="text" class="indexBtn" @click="$router.push('/wxUser/list')">
          <svg-icon icon-class="wechat" class="indexBtnIcon" style="color:#69B942;" />
          <div class="indexBtnDiv">认证审核</div>
        </el-button>
        <!-- <el-button v-if="usertype===1||usertype===2" type="text" class="indexBtn" @click="$router.push('/order/index')">
          <svg-icon icon-class="shopping" class="indexBtnIcon" style="color:#B97742;" />
          <div class="indexBtnDiv">订单管理</div>
        </el-button> -->
        <el-button v-if="usertype===3" type="text" class="indexBtn" @click="$router.push('/setting/vol')">
          <svg-icon icon-class="table" class="indexBtnIcon" style="color:#4282B9;" />
          <div class="indexBtnDiv">期数管理</div>
        </el-button>
        <!-- <el-button v-if="usertype===3" type="text" class="indexBtn" @click="$router.push('/setting/infoClass')">
          <svg-icon icon-class="list" class="indexBtnIcon" style="color:#B97742;" />
          <div class="indexBtnDiv">信息分类</div>
        </el-button>
        <el-button v-if="usertype===3" type="text" class="indexBtn" @click="$router.push('/setting/user')">
          <svg-icon icon-class="user" class="indexBtnIcon" style="color:#42B9B7;" />
          <div class="indexBtnDiv">管理员管理</div>
        </el-button> -->
      </div>
    </el-row>

  </div>
</template>

<script>

export default {
  name: 'DashboardAdmin',
  components: {
  },
  data() {
    return {
      usertype: null
    }
  },
  mounted() {
    this.usertype = JSON.parse(localStorage.getItem('user')).usertype
    this.getPaperFlag()
    this.getPriceXcx()
    this.getPriceXcxTop()
  },
  methods: {
    getPaperFlag() {
      this.$http
        .get('/api/busConfig/getValByKey?key=paperFlag')
        .then(response => {
          if (response.data.success === true) {
            localStorage.setItem('paperFlag', response.data.result)
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
        })
    },
    getPriceXcx() {
      this.$http
        .get('/api/busConfig/getValByKey?key=priceXcx')
        .then(response => {
          this.btnLoading = false
          if (response.data.success === true) {
            localStorage.setItem('priceXcx', response.data.result)
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.btnLoading = false
        })
    },
    getPriceXcxTop() {
      this.$http
        .get('/api/busConfig/getValByKey?key=priceXcxTop')
        .then(response => {
          this.btnLoading = false
          if (response.data.success === true) {
            localStorage.setItem('priceXcxTop', response.data.result)
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.btnLoading = false
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
.indexBtn{
  font-size:16px;color:#333;
}
.indexBtnIcon{
  width:28px;height:28px;float:left;margin:0 0 0 20px;
}
.indexBtnDiv{
  line-height:25px;float:left;margin:0 35px 0 10px;color:#333;
}
body{
  background-color: rgb(240, 242, 245);
}
#block_data{
  width: 939px;
  height:257px;
  margin:50px 0 0 25px;
  padding:30px;
  background-image:url('../../assets/indexblock1.png');
}
#block_info{
  width: 734px;
  height:781px;
  margin:50px 0 0 25px;
  padding:30px;
  background-image:url('../../assets/indexblock2.png');
}
#icon_data{
  display: inline-block;
  background:url('../../assets/icon_data.png') bottom no-repeat;
  width: 36px;
  height:36px;
  padding: 0;
  margin-right:10px;
}
#icon_info{
  display: inline-block;
  background:url('../../assets/icon_info.png') bottom no-repeat;
  width: 38px;
  height:36px;
  padding: 0;
  margin-right:10px;
}
.dashboard-editor-container {
  padding: 20px 20px 0;
  // background-color: rgb(240, 242, 245);
  position: relative;

  background-image:url('../../assets/mainback.png');
  height:calc(100vh - 50px);
  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 20px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
